<template>
  <el-button plain @click="dialogVisible = true">
    Click to open the Dialog
  </el-button>
  <el-select v-model="theme">
    <el-option value="default">Default</el-option>
    <el-option value="github">GitHub</el-option>
    <el-option value="far">far</el-option>
    <el-option value="gml">gml</el-option>
    <!-- 添加更多主题选项 -->
  </el-select>
  <el-dialog
      v-model="dialogVisible">
    <MarkdownParser :data="MarkdownData" :theme="theme"></MarkdownParser>
  </el-dialog>
</template>
<script setup lang="ts">
import MarkdownParser from "@/components/MarkdownParser/index.vue"
import {onBeforeMount, ref} from "vue";
import axios from "axios";

const dialogVisible = ref(false)
onBeforeMount(async () => {
  await getData()
})

let MarkdownData = ref("")
let theme = ref("default")
const getData = async () => {
  let {data} = await axios.get("https://back.xuxiao888.com/post/1")
  MarkdownData.value = data.data[0].content
}
</script>
<style scoped lang="scss">

</style>